<?xml version="1.0" encoding="UTF-8" ?>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>  
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>      
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<script type="text/javascript" src="../../../js/jquery.js"></script>
<script type="text/javascript" src="../../../js/jquery-ui-personalized.min.js"></script>
<script type="text/javascript" src="../js/common.js"></script>
<link type="text/css" href="../../../style/theme/ui.all.css" rel="stylesheet" />
<link type="text/css" href="../style/style.css" rel="stylesheet"/>
<title>邮件列表</title>
</head>
<body>
	<h1>${student.dormitory.name }邮件列表</h1>
	<div class="filterForm">
		<form action="mailList.do" method="get">
			<select name="type">
				<option value="dormitory">寝室</option>
			</select>
			<label for="fromDate">起始日期</label>
			<input name="fromDate" id="fromDate" type="text" value="${mailDTO.fromDate }" class="datepicker"/>
			<label for="toDate">结束日期</label>
			<input name="toDate" id="toDate" type="text" value="${mailDTO.toDate }" class="datepicker"/>
			<input type="submit" name="submit" value="查询"/>
		</form>
	</div>
	
	<c:choose>
		<c:when test="${!empty mails.list}">
			<table id="mails" border="1px">
				<thead>
					<tr>
						<th>ID</th>
						<th>学生姓名</th>
						<th>描述</th>
						<th>发布日期</th>
					</tr>
				</thead>
				<tbody>
					<c:forEach items="${mails.list}" var="mail">
						<tr>
							<td>${mail.id }</td>
							<td>${mail.student }</td>
							<td>${mail.description }</td>
							<td>
								<fmt:formatDate value="${mail.arriveDate}" pattern="yyyy-MM-dd HH:mm"/>
							</td>
						</tr>
					</c:forEach>
				</tbody>
			</table>
		</c:when>
		<c:otherwise>
			<p>暂时没有符合条件的邮件</p>			
		</c:otherwise>
	</c:choose>
</body>
</html>